package com.ruoyi.system.controller;

import com.alibaba.fastjson.JSONArray;
import com.ruoyi.system.domain.GzdsQuestionInfo;

import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

/**
 * @author sxctc
 * @title: Test
 * @projectName ruoyi
 * @description: TODO
 * @date 2021/5/2610:06
 */
public class Test {

    public static void main(String[] args) throws  Exception{
//        SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        Date startTime = sd.parse("2021-05-27 17:59:06");
//        Date endTime = sd.parse("2021-05-27 18:16:06");
//        //gzdsGrade.setEndTime(endTime);
//        Calendar Startcalendar = Calendar.getInstance();
//        Startcalendar.setTime(startTime);
//        Calendar Endcalendar = Calendar.getInstance();
//        Endcalendar.setTime(endTime);
//        long Starttime = Startcalendar.getTimeInMillis();
//        long Endtime = Endcalendar.getTimeInMillis();
//        long between_days = Endtime - Starttime;
//        int time = Integer.parseInt(String.valueOf(between_days));
//        float i = (1 - ((float) time / 1000) / (30 * 60)) * 30 + ((float) 31 / 40) * 70;
//        NumberFormat formatter = new DecimalFormat("0.00");
//        String formmatedFloatValue = formatter.format(i);
//        System.out.println(formmatedFloatValue);

        String str = "[\n" +
                "\t\t{\n" +
                "\t\t\t\"questionId\": \"12\",\n" +
                "\t\t\t\"answer\": \"A\"\n" +
                "\t\t},\n" +
                "\t\t{\n" +
                "\t\t\t\"questionId\": \"12\",\n" +
                "\t\t\t\"answer\": \"A\"\n" +
                "\t\t}\n" +
                "\t]";

        List<GzdsQuestionInfo> list = JSONArray.parseArray(str, GzdsQuestionInfo.class);
        System.out.println(list.size());
    }
}
